package com.amit.jdbc.oracle;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class Lab1 {

	public static void main(String[] args) {
		
		try
		{
			
			//1.Loading the driver class
			Class.forName("oracle.jdbc.driver.OracleDriver");
			
			//2.Creat a connection
			
			Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","amit");
			
			//3.Prepare the sql query
			
			String sql="insert into amit values(1,'amit','amit@gmail.com',12333,22.0)";
			
			//4.create the statement
			
			Statement st=con.createStatement();
			
			//5.Submit the jdbc statment
			
			int i=st.executeUpdate(sql);
			
			
			//6.Process the result
			
			System.out.println(i+"row inserted");
			
			//7.close the connection
			
			con.close();
			
		}
		
		catch (Exception e) {
			
			e.printStackTrace();
			
		}
		

	}

}
